#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#include<stdio.h>
struct msgbuf
{
    long type;
    int groupid;
    int appid;
    char buf[1024];
};
int main()
{
    int msgid;
    msgid=msgget(0x1000,IPC_CREAT | 0777);
    struct msgbuf mb;
    msgrcv(msgid,&mb,sizeof(struct msgbuf)-sizeof(long),1,0);
    printf("type: %d\tgroupid: %d\tappid: %d\n", mb.type,mb.groupid, mb.appid);
    puts(mb.buf);

    return 0;
}
